package ink.onei.user.service.impl;

import java.util.List;
import ink.onei.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import ink.onei.user.mapper.ClientMapper;
import ink.onei.user.domain.Client;
import ink.onei.user.service.IClientService;

/**
 * 客户Service业务层处理
 * 
 * @author nekotako
 * @date 2024-02-08
 */
@Service
public class ClientServiceImpl implements IClientService  {
    @Autowired
    private ClientMapper clientMapper;

    /**
     * 查询客户
     * 
     * @param clientId 客户主键
     * @return 客户
     */
    @Override
    public Client selectClientByClientId(Long clientId) {
        return clientMapper.selectClientByClientId(clientId);
    }

    /**
     * 查询客户列表
     * 
     * @param client 客户
     * @return 客户
     */
    @Override
    public List<Client> selectClientList(Client client) {
        return clientMapper.selectClientList(client);
    }

    /**
     * 新增客户
     * 
     * @param client 客户
     * @return 结果
     */
    @Override
    public int insertClient(Client client) {
        client.setCreateTime(DateUtils.getNowDate());
        return clientMapper.insertClient(client);
    }

    /**
     * 修改客户
     * 
     * @param client 客户
     * @return 结果
     */
    @Override
    public int updateClient(Client client) {
        return clientMapper.updateClient(client);
    }

    /**
     * 批量删除客户
     * 
     * @param clientIds 需要删除的客户主键
     * @return 结果
     */
    @Override
    public int deleteClientByClientIds(Long[] clientIds) {
        return clientMapper.deleteClientByClientIds(clientIds);
    }

    /**
     * 删除客户信息
     * 
     * @param clientId 客户主键
     * @return 结果
     */
    @Override
    public int deleteClientByClientId(Long clientId) {
        return clientMapper.deleteClientByClientId(clientId);
    }
}
